/*     */ package btsm.bean;
/*     */ 
/*     */ import java.io.PrintStream;
/*     */ import java.sql.ResultSet;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class BTSPage
/*     */ {
/*  15 */   String sqlCount = "";
/*  16 */   String sqlPage = "";
/*  17 */   int ShowPage = 1;
/*  18 */   int RowCount = 0;
/*  19 */   int PageCount = 0;
/*  20 */   int redundance = 0;
/*     */   public String HttpFile;
/*     */   String tablea;
/*     */   String ida;
/*  26 */   public String texta = null;
/*  27 */   private sqlBTSWork sw = null;
/*     */ 
/*     */   public BTSPage(String tableaa, String idaa)
/*     */   {
/*  31 */     this.tablea = tableaa;
/*  32 */     swInit();
/*     */   }
/*     */ 
/*     */   private void swInit() {
/*  36 */     if (this.sw == null)
/*  37 */       this.sw = new sqlBTSWork(this.tablea, this.ida);
/*     */   }
/*     */ 
/*     */   public void dbConClose() {
/*  41 */     if (this.sw != null)
/*  42 */       this.sw.dbConClose();
/*     */   }
/*     */ 
/*     */   public ResultSet myQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize) throws Exception
/*     */   {
/*  47 */     swInit();
/*     */ 
/*  49 */     ResultSet rs = null;
/*  50 */     this.HttpFile = request.getRequestURI();
/*  51 */     this.RowCount = this.sw.getCountPage();
/*     */ 
/*  53 */     this.redundance = (this.RowCount % PageSize);
/*  54 */     if (this.redundance == 0) {
/*  55 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/*  57 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/*  58 */       this.PageCount += 1;
/*     */     }
/*  60 */     String ToPage = request.getParameter("ToPage");
/*  61 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/*  62 */       ToPage = "1";
/*     */     }
/*  64 */     System.out.println("myQuery:LGTOPAGE2:" + ToPage);
/*  65 */     this.ShowPage = Integer.parseInt(ToPage);
/*  66 */     if (this.ShowPage > this.PageCount) {
/*  67 */       this.ShowPage = this.PageCount;
/*     */     }
/*  69 */     if (this.ShowPage <= 0) {
/*  70 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/*  73 */     if (PageType == 0)
/*  74 */       rs = this.sw.scpage(this.ShowPage, PageSize);
/*     */     else {
/*  76 */       rs = this.sw.scPageByID(this.ShowPage, PageSize);
/*     */     }
/*  78 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet myBTSFQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize, String strFilter) throws Exception
/*     */   {
/*  83 */     swInit();
/*     */ 
/*  85 */     ResultSet rs = null;
/*  86 */     this.HttpFile = request.getRequestURI();
/*     */ 
/*  88 */     this.RowCount = this.sw.getCableCountPage(strFilter);
/*     */ 
/*  90 */     this.redundance = (this.RowCount % PageSize);
/*  91 */     if (this.redundance == 0) {
/*  92 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/*  94 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/*  95 */       this.PageCount += 1;
/*     */     }
/*  97 */     String ToPage = request.getParameter("ToPage");
/*  98 */     System.out.println("before ToPage:" + ToPage);
/*  99 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 100 */       ToPage = "1";
/*     */     }
/* 102 */     System.out.println("ToPage:" + ToPage);
/* 103 */     this.ShowPage = Integer.parseInt(ToPage);
/* 104 */     if (this.ShowPage > this.PageCount) {
/* 105 */       this.ShowPage = this.PageCount;
/*     */     }
/* 107 */     if (this.ShowPage <= 0) {
/* 108 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 111 */     this.sw.wheresw = strFilter;
/*     */ 
/* 113 */     if (PageType == 0)
/* 114 */       rs = this.sw.scCableFPage(this.ShowPage, PageSize);
/*     */     else
/* 116 */       rs = this.sw.scCableFPageByID(this.ShowPage, PageSize);
/* 117 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet BlurQuery(HttpServletRequest request, HttpServletResponse response, int iType, int PageSize, String strFilter) throws Exception
/*     */   {
/* 122 */     swInit();
/*     */ 
/* 124 */     ResultSet rs = null;
/* 125 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 127 */     this.RowCount = this.sw.getCountPageBQuery(strFilter);
/*     */ 
/* 129 */     this.redundance = (this.RowCount % PageSize);
/* 130 */     if (this.redundance == 0) {
/* 131 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 133 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 134 */       this.PageCount += 1;
/*     */     }
/* 136 */     String ToPage = request.getParameter("ToPage");
/* 137 */     System.out.println("before ToPage:" + ToPage);
/* 138 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 139 */       ToPage = "1";
/*     */     }
/* 141 */     System.out.println("ToPage:" + ToPage);
/* 142 */     this.ShowPage = Integer.parseInt(ToPage);
/* 143 */     if (this.ShowPage > this.PageCount) {
/* 144 */       this.ShowPage = this.PageCount;
/*     */     }
/* 146 */     if (this.ShowPage <= 0) {
/* 147 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 150 */     rs = this.sw.BQuery(this.ShowPage, PageSize, iType, strFilter);
/*     */ 
/* 152 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet BlurExpQuery(int iType, String strFilter) throws Exception
/*     */   {
/* 157 */     swInit();
/* 158 */     ResultSet rs = null;
/*     */ 
/* 160 */     rs = this.sw.BExpQuery(iType, strFilter);
/*     */ 
/* 162 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet myUsersQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize) throws Exception
/*     */   {
/* 167 */     ResultSet rs = null;
/* 168 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 170 */     this.RowCount = this.sw.getUsersCountPage();
/*     */ 
/* 172 */     System.out.println("myUsersQuery:b");
/* 173 */     this.redundance = (this.RowCount % PageSize);
/* 174 */     if (this.redundance == 0) {
/* 175 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 177 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 178 */       this.PageCount += 1;
/*     */     }
/* 180 */     String ToPage = request.getParameter("ToPage");
/*     */ 
/* 182 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 183 */       ToPage = "1";
/*     */     }
/* 185 */     System.out.println("ToPage:" + ToPage);
/* 186 */     this.ShowPage = Integer.parseInt(ToPage);
/* 187 */     if (this.ShowPage > this.PageCount) {
/* 188 */       this.ShowPage = this.PageCount;
/*     */     }
/* 190 */     if (this.ShowPage <= 0) {
/* 191 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 194 */     return this.sw.scUsersPage(this.ShowPage, PageSize);
/*     */   }
/*     */ 
/*     */   public int getTotalPages()
/*     */   {
/* 201 */     return this.PageCount;
/*     */   }
/*     */ 
/*     */   public int getCurrenPages()
/*     */   {
/* 207 */     return this.ShowPage;
/*     */   }
/*     */ 
/*     */   public int getRowCount()
/*     */   {
/* 212 */     return this.RowCount;
/*     */   }
/*     */ 
/*     */   public String PageFooter(String strParam)
/*     */   {
/* 217 */     String str = "";
/*     */ 
/* 219 */     int prev = this.ShowPage - 1;
/* 220 */     int next = this.ShowPage + 1;
/* 221 */     str = str + "查询到<span>" + getRowCount() + "</span>条记录" + 
/* 222 */       "    共<span>" + getTotalPages() + "</span>页";
/* 223 */     str = str + " 第<span>" + getCurrenPages() + "</span>页 ";
/* 224 */     if (this.ShowPage > 1)
/* 225 */       str = str + " <A href=" + strParam + "ToPage=1" + ">首页</A> ";
/*     */     else {
/* 227 */       str = str + " 首页 ";
/*     */     }
/* 229 */     if (this.ShowPage > 1)
/* 230 */       str = str + " <A href=" + strParam + "ToPage=" + prev + ">上一页</A> ";
/*     */     else {
/* 232 */       str = str + " 上一页 ";
/*     */     }
/* 234 */     if (this.ShowPage < this.PageCount)
/* 235 */       str = str + " <A href=" + strParam + "ToPage=" + next + ">下一页</A> ";
/*     */     else {
/* 237 */       str = str + " 下一页 ";
/*     */     }
/* 239 */     if ((this.PageCount > 1) && (this.ShowPage != this.PageCount))
/* 240 */       str = str + " <A href=" + strParam + "ToPage=" + this.PageCount + 
/* 241 */         ">尾页</A>";
/*     */     else {
/* 243 */       str = str + " 尾页 ";
/*     */     }
/* 245 */     str = str + "&nbsp;&nbsp;第<input name=ToPage type=text size=2>页 <input type=submit value=GO>";
/* 246 */     return str;
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.bean.BTSPage
 * JD-Core Version:    0.6.2
 */